package com.aier.exception;

import com.aier.bean.common.GlobalCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 自定义异常类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CustomException extends RuntimeException{
    private String code;

    public CustomException(String code, String message){
        super(message);
        this.code = code;
    }

    public CustomException(GlobalCode globalCode){
        super(globalCode.getMessage());
        this.code=globalCode.getCode();
    }
}
